package nl.soekoor.recipes.dao.hibernate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.Table;

import nl.soekoor.recipes.data.Recipe;

@Entity
@Table(name = "recipe")
public class AnnotatedRecipe {

	private int id;

	private String name;

	private String comments;

	// private List<Ingredient> ingredients;

	@Id(generate = GeneratorType.AUTO)
	public int getId() {
		return id;

	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	/*
	 *  / public List<Ingredient> getIngredients() { return ingredients; }
	 * public void setIngredients(List<Ingredient> ingredients) {
	 * this.ingredients = ingredients; }
	 */

	public void copyAnnotatedVersion(Recipe recipe) {
		setName(recipe.getName());
		setComments(recipe.getComments());
	}

	public Recipe copyToDataVersion() {
		Recipe recipe = new Recipe();
		recipe.setId(getId());
		recipe.setName(getName());
		recipe.setComments(getComments());
		return recipe;
	}
}
